Developer --> Technical Publications
PATHHardware Documentation > USB Devices > Mac OS USB DDK API Reference


Getting The Connection ID For Class Driver

The USBGetDriverConnectionID function returns a pointer to the connection ID, CFragConnectionID , of the driver referenced by the device or interface reference.

OSStatus USBGetDriverConnectionID (
                     USBDeviceRef *deviceRef,
                     CFragConnectionID *connID);

--> deviceRef
A pointer to the device or interface reference for which you want a connection ID.
<-- connID
A pointer to the connection ID.

This function can be used to get the code fragment connection ID of a device driver or interface driver. An example of its use in a application would be to locate and display information about a device driver. You could use the USBGetDriverConnectionID function to get the connection ID, and then pass the connection ID to the FindSymbol function, defined in Inside Macintosh: Power PC System Software, Chapter 3, "Code Fragment Manager," to locate the address of the pTheUSBDriverDescription structure, which contains the USB driver description information.

Here's a code snippet showing the basic idea. This snippet does not include any error or system zone checking code, which the driver would have to supply.

USBGetDriverConnectionID(&theDeviceRef, &connID);
FindSymbol (connID, "\pTheUSBDriverDescription",
            (Ptr *)&pTheUSBDriverDescription, &symClass);
sprinf((char *)buf, "Driver Description Version:. 0x%04x",
            pTheUSBDriverDescription->usbDriverDescVersion);

© 1999 Apple Computer, Inc.

Previous | Back Up One Level | Next | Show Frames | Hide Frames